package com.cictec.middleware.gps.engine.position.handler.shiftAndTrip;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cictec.middleware.commons.utils.PMSUtils;
import com.cictec.middleware.core.entity.DeparterSchedule;
import com.cictec.middleware.gps.engine.BusInstance;
import com.cictec.middleware.gps.engine.TimingPoint;
import com.cictec.middleware.gps.engine.exception.BusPositionHandlerException;
import com.cictec.middleware.gps.service.ScheduleService;

/**
 * 没有上下行时候班次趟次信息处理
 * @author ql
 */
@Service
public class LineTypeNotExistShitTripHandler {

	@Autowired
	private ScheduleService scheduleService;
	
	public void onHandler(BusInstance busInstance) throws BusPositionHandlerException {
		
		/*
		 * 没有上下行时候 取最近趟次
		 */
		if(busInstance.getCurrentTripStartPoint() != null){
			// 趟次没有结束,取上一个点的趟次信息
			TimingPoint point = busInstance.getCurrentTripStartPoint();
			busInstance.setCurrentShift(point.getCurrentShift());
			busInstance.setCurrentTrip(point.getCurrentTrip());
			busInstance.setCurrentTripPlanTime(point.getCurrentTripPlanTime());
			busInstance.setCurrentTripStartTime(point.getCurrentTripStartTime());
		}
		
	}
}
